package com.thon.entity.project;

// Generated 2013-9-23 19:12:56 by Hibernate Tools 3.4.0.CR1

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.crypto.Data;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.thon.commons.utils.ImageUrl;
import com.thon.entity.user.Attachment;
import com.thon.entity.util.IdEntity;

@Entity
@Table(name = "products")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Product extends IdEntity {

	private static final long serialVersionUID = -8544188730815102244L;
	private Integer photoId;
	private Integer projectId;
	private String name;
	private String code;
	private Integer price;
	private String description;
	private Integer ammount;
	private Integer remaining;
	private Integer caps;
	private String permissions;

	public Product() {
	}


	@Column(name = "project_id", nullable = false)
	public Integer getProjectId() {
		return projectId;
	}

	public void setProjectId(Integer projectId) {
		this.projectId = projectId;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Integer getPrice() {
		return this.price;
	}

	public void setPrice(Integer price) {
		this.price = price;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getAmmount() {
		return ammount;
	}

	public void setAmmount(Integer ammount) {
		this.ammount = ammount;
	}


	public Integer getPhotoId() {
		return photoId;
	}


	public void setPhotoId(Integer photoId) {
		this.photoId = photoId;
	}
	
	@Transient
	public String getPhotoUrl(){
		return ImageUrl.format(this.photoId);
	}


	public Integer getRemaining() {
		return remaining;
	}


	public void setRemaining(Integer remaining) {
		this.remaining = remaining;
	}


	public Integer getCaps() {
		return caps;
	}


	public void setCaps(Integer caps) {
		this.caps = caps;
	}


	public String getPermissions() {
		return permissions;
	}


	public void setPermissions(String permission) {
		this.permissions = permission;
	}
}